using Godot;
using System;

public partial class Mob : RigidBody2D
{

	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
        // 三个动画类型中随机选择一个播放
        AnimatedSprite2D animatedSprite2D = this.GetNode<AnimatedSprite2D>("AnimatedSprite2D");
        string[] animaionNames = animatedSprite2D.SpriteFrames.GetAnimationNames();
        long random = GD.Randi() % animaionNames.Length;
		animatedSprite2D.Play(animaionNames[random]);
	}

	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{

	}

	// 退出屏幕时销毁自己
	private void OnVisibleOnScreenNotifier2dScreenExited()
	{
		QueueFree();
	}

}
